<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
	<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
	<c:choose>
	<c:when test="${empty sessionScope.user}">
		<form name = "loginform" method="post" action="ForumController">
			<table>
				<tr>
					<td> User name: </td><td> <input name="username" size=15 type ="text"/></td>
				</tr>
				<tr>
					<td> Password:</td><td> <input name="password" size=15 type = "password"/></td>
				</tr>
				<c:if test="${not empty param.subForumID }">
					<input type="hidden" name="subForumID" value="${param.subForumID }">
				</c:if>
				<c:if test="${not empty param.threadID }">
					<input type="hidden" name="threadID" value="${param.threadID }">
				</c:if>
				<input type="hidden" name="action" value="login">
			<td>
				<input type="submit" value="Login"/>
			</td>
			</form>
			<td>
				<FORM METHOD="LINK" ACTION="register.jsp">
 					<INPUT TYPE="submit" VALUE="Register">
 					<input type="hidden" name="action" value="register">
 				</FORM>
		    </td>
		    </table>
		
	</c:when>
	<c:otherwise>
	<div style="background-color:lightgrey; border: 1px dotted black">
		
		<form name="logout" method="post" action="ForumController">
		<big>${sessionScope.user.email}</big><br>
			<input type="hidden" name="action" value="logout">
			<input type="submit" value="logout"/>
		</form>
		<form name = "userprofile" method="post" action="ForumController">
			<input type="hidden" name="action" value="profile">
			<input type="hidden" name="userID" value="${sessionScope.user.userID}">
			<input type="submit" value="Profile"/>
		</form>
		<form name = "sendPM" method="post" action="ForumController">
			<input type="hidden" name="action" value="sendPM">
			<input type="hidden" name="userID" value="${sessionScope.user.userID}">
			<input type="submit" value="Send PM"/>
		</form>
	</div>
	</c:otherwise>
	</c:choose>
</body>
</html>